<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>05_ES6常用语法</title>
  </head>
  <body>
    <script type="module">
      /* 
      1. let与const
      2. 解构赋值

      3. 字符串扩展: 模板字符串
      4. 对象扩展: 属性简写与方法简写, 扩展符
      5. 数组扩展: 扩展符, find/findIndex/includes
      6. 函数扩展: 箭头函数 / 参数默认值 / 剩余参数

      7. 类语法: class / constructor / extends / super / static
      8. 异步语法: Promise / async & await
      9. 模块化语法: export / default / import
      */

      // 通过解构赋值方式取出模块对象中的a1/a2属性
      import {a1, a2} from './05_test.js'
      console.log(a1, a2)

      // 引入全部
      import * as test from './05_test.js'
      console.log(test)

      // 引入默认的
      import {default as xxx} from './05_test.js' // 完整写法
      import yyy from './05_test.js' // 简写
      console.log(xxx, xxx===yyy)

      import {a4, a5} from './05_test.js'
      console.log(a4, a5)

     /*  {
        a1: 3,
        a2: {m: 1}
        default: function () {}
        a4: 'abc'
        a5: [1, 2, 3]
      } */
    </script>
  </body>
</html>
